<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/style.css" />

		<style>
			#help {
				text-align: center;
				font-size: 14px;
				color: #666;
			}
			
			#help a {
				color: #666;
			}
		</style>
	</head>

	<body class="public-fff-bgcolor">
		<div style=" position:fixed; left:0px; bottom:0px; width:100%; height:200px; z-index:9999;padding: 50px;;">
			<!--<button class="public-block-btn" id="btn">开始使用</button>-->
		</div>
		<!--头部导航-->
		<script src="js/iBase.js"></script>
		<script type="text/javascript">
			// 当APP启动的时候，我们就吧请求的URL写到本地存储里面，以方便其他界面使用

			iBase.init();
			iBase.dblclickExit();
			localStorage.setItem('request_url', "http://192.168.199.102:8052");
			var request_url = localStorage.getItem('request_url');

			mui.plusReady(function() {
				plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
					//console.log(wgtinfo.version);
					var request_url = localStorage.getItem('request_url');
					// 原理 -> 请求数据库 查看是否有新版本 -> 返回版本信息
					iBase.get({
						url: request_url + '/Common_Permission/DownLoad/GetLatestReleaseMobileClientVersion?type=yezhu',
						data: {},
						succFn: function(data) {
							var json = JSON.parse((data));
							if(json.data.VersionCode == wgtinfo.version) {
								iBase.prompt('没有新版本');
							} else {

								iBase.confirm({
									title: '提示',
									content: '发现新版本，是否更新？',
									callback: function(data) {
										if(data) {
											iBase.openUrl(json.data.Url);
										}
									}
								});
							}
						}
					});
				});
				//console.log(plus.runtime.version+"\n内核版本号："+plus.runtime.innerVersion);
			})

			//console.log(request_url);
			//var request_url = localStorage.getItem('request_url');
			// 在这个界面中判断你是否已经登录，如果登录，调整到主页面，如果没有登录，跳转到登录界面

			setTimeout(function() {

				if(window.plus && plus.networkinfo.getCurrentType() === plus.networkinfo.CONNECTION_NONE) {
					iBase.prompt("似乎已断开与互联网的连接");
					return;
				}
				
				iBase.newInterface({
					url: 'Login.html',
					id: 'login'
				});


			}, 1000);
			iBase.receiveNotice('OpenServerUrl', function(msg) {
				//var json = JSON.parse(msg.detail);
				var url = msg.detail.url;
				if(msg.detail.url.startsWith("/")) {
					url = request_url + url;
				}
				iBase.newInterface({
					url: url,
					id: msg.detail.id,
					extras: msg.detail.extras
				});
			});
			iBase.receiveNotice('OpenLocalUrl', function(msg) {
				//var json = JSON.parse(msg.detail);
				var url = msg.detail.url;

				iBase.newInterface({
					url: url,
					id: msg.detail.id,
					extras: msg.detail.extras
				});
			});

			iBase.receiveNotice('resetAPPData', function() {
				if(config.debug) {
					console.log('resetAPPData')
				}
				localStorage.setItem('local_username', "");

			});
		</script>
	</body>

</html>